<?php

namespace App\Http\Requests\Admin\Customer\Store;

use App\Http\Requests\ApiRequest;

/**
 * @property int is_deleted
 * @property int priority
 * @property int name
 * @property int thumb
 * @property int pack_category_id
 */
class PackPatchRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $data = [
            'is_deleted'       => 'required|int|in:0,1',
            'priority'         => 'required|int|between:0,10000',
            'name'             => 'required|string|max:'.self::MAX_STRING,
            'pack_category_id' => 'nullable|int|min:1',
        ];

        if (is_file($this->thumb)) {
            $data['thumb'] = 'required|file|max:2048';
        }

        return $data;
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'is_deleted.*' => '整体妆容的状态必须是0或1',
//            'priority.*'   => '整体妆容的排序规则必须是大于0的数值',
//            'name.*'       => '整体妆容名称必须',
//            'thumb.*'      => '整体妆容的缩略图必须是文件',
//        ];
//    }
}
